package com.novax.ex.activity.provider.controller.inner;

import com.novax.ex.activity.open.api.inner.TaskAwardLogApi;
import com.novax.ex.activity.open.model.query.TaskAwardLogQuery;
import com.novax.ex.activity.open.model.response.TaskAwardLogResponse;
import com.novax.ex.activity.provider.controller.BaseActivityController;
import com.novax.ex.activity.provider.service.TaskAwardLogService;
import com.novax.ex.common.constant.InternationalCode;
import com.novax.ex.common.results.ReturnResult;
import com.novax.ex.common.util.PageUtil;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;
import java.util.Collections;

@RestController
public class TaskAwardLogController extends BaseActivityController implements TaskAwardLogApi {

    @Resource
    private TaskAwardLogService taskAwardLogService;

    @Override
    public ReturnResult<PageUtil<TaskAwardLogResponse>> page(String language, TaskAwardLogQuery query) {
        PageUtil<TaskAwardLogResponse> pageInfo = new PageUtil<>(query);
        pageInfo.setCondition(Collections.singletonMap("query", query));
        taskAwardLogService.findPage(pageInfo, TaskAwardLogResponse.class);
        return ReturnResult.success(getInternational(language, InternationalCode.QUERY_SUCCESS), pageInfo);
    }
}
